<template>
  <div class="acompany-info">
    <div class="search-content">
      <Col class="panel content-header" :span="24">
      <div class="title-bar cf">
        <h5 class="fl">
          <span>
            <a href="javascript:void(0);" class="link" @click="backToCompany">
              <i class="fa fa-angle-left" aria-hidden="true"></i>返回上一页</a>
            <span class="dashboard-card-sep">|</span>
            <span class="dashboard-card-name"><span>企业设置</span></span>
          </span>
        </h5>
        <Breadcrumb>
          <BreadcrumbItem to="/company">企业管理</BreadcrumbItem>
          <BreadcrumbItem>企业设置</BreadcrumbItem>
        </Breadcrumb>
      </div>
      </Col>
    </div>
    <!-- 标签页 -->
    <Col class="panel tab-panel acompany-tab-panel" :span="24" ref="refDetail" v-if="JSON.stringify(selectRow) != '{}'">
    <Tabs style="height: 100%;" :animated="false" :value="tabCurrentName" @on-click="tabBeClick">
      <TabPane label="企业基本信息" style="height: 100%" name="first">
        <BaseInforTab :id="id" v-if="tabCurrentName==='first'" />
      </TabPane>
      <TabPane label="峰平谷尖管理" name="second">
        <fengPingTab :row="selectRow" v-if="tabCurrentName==='second'" />
      </TabPane>
      <TabPane label="区域管理" name="third">
        <areaTab :row="selectRow" v-if="tabCurrentName==='third'" />
      </TabPane>
      <TabPane label="配电图管理" name="forth">
        <UploadImage :id="id" v-if="tabCurrentName==='forth'" />
      </TabPane>
      <TabPane label="设备点位标记" name="fifth">
        <DisplayGallery :id="id" v-if="tabCurrentName==='fifth'"></DisplayGallery>
      </TabPane>
    </Tabs>
    </Col>
  </div>
</template>
<script>
import areaTab from './components/areaTab'
import fengPingTab from './components/fengPingTab'
import BaseInforTab from './components/BaseInforTab'
const DisplayGallery = () => import('./components/DisplayGallery')
const UploadImage = () => import('./components/UploadImage')
export default {
  components: {
    areaTab,
    fengPingTab,
    BaseInforTab,
    DisplayGallery,
    UploadImage
  },
  created() {
    this.selectRow = JSON.parse(decodeURIComponent(this.$route.query.params))
    this.id = this.selectRow.id
  },
  data() {
    return {
      selectRow: {},
      id: '',
      tabCurrentName: 'first'
    }
  },
  methods: {
    tabBeClick(name) {
      this.tabCurrentName = name
    },
    backToCompany() {
      this.$router.push({
        path: '/company',
        query: {
          page: this.selectRow.page
        }
      })
    }
  }
}
</script>
